import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/table';
import { render } from '@apps/antd-admin/src/hooks/render/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '线路名称',
    dataIndex: 'tourRouteName',
    width: 160,
  },
  {
    title: '线路图片',
    dataIndex: 'tourRouteImg',
    width: 200,
    customRender: render.renderImage,
  },
  {
    title: '供应商名称',
    dataIndex: 'tourServiceShopName',
    width: 160,
  },
  {
    title: '线路价格',
    dataIndex: 'tourRoutePrice',
    width: 100,
  },
  {
    title: '线路目的地',
    dataIndex: 'tourAddress',
    width: 160,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'tourRouteName',
    label: '线路名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'tourServiceShopName',
    label: '供应商名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'tourRoutePrice',
    label: '线路价格',
    component: 'Input',
    colProps: { span: 5 },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '旅游线路Id',
    field: 'tourRouteId',
    component: 'Input',
    required: false,
    show: false,
  },
  {
    label: '线路名称',
    field: 'tourRouteName',
    component: 'Input',
    required: true,
  },
  {
    label: '供应商名称',
    field: 'tourServiceShopName',
    component: 'Input',
    required: true,
  },
  {
    label: '线路价格',
    field: 'tourRoutePrice',
    component: 'InputNumber',
    required: true,
  },
  {
    label: '线路图片',
    field: 'tourRouteImg',
    component: 'ImageUpload',
    required: false,
    componentProps: {
      fileMax: 3,
    },
  },
  {
    label: '线路目的地',
    field: 'tourAddress',
    component: 'Input',
    required: true,
  },
  {
    label: '线路描述',
    field: 'tourDesc',
    component: 'InputTextArea',
    required: false,
    componentProps: {
      autoSize: { minRows: 2, maxRows: 30 },
    },
  },
];
